package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.ShopBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;


@Mapper
@Repository
public interface IShopMapper extends BaseMapper<ShopBean> {
    @Select("SELECT s.*,p.`p_name`,p.`p_price`,p.`p_factory` FROM t_shop s,t_product p" +
            " WHERE s.`fk_productId`=p.`pk_productId` AND s.`fk_userId`=#{userId}")
    @ResultMap("shopMap")
    List<ShopBean> findByUser(int userId);
}